package com.project.mapper;

import com.project.bean.BookBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IBookMapper {
    /**
     * 按id查询书籍，并查询该书籍的评论，书籍评论中显示用户名
     * @param id 书籍id
     * @return 书籍对象
     */
    public BookBean findById(Integer id);

    @Select("select * from t_book")
    @ResultMap("bookMap")
    public List<BookBean> findAll();
}
